<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Retrieve the next message from the queue.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="amqpqueue.delete.html">AMQPQueue::delete</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="amqpqueue.getargument.html">AMQPQueue::getArgument</a></div>
 <div class="up"><a href="class.amqpqueue.html">AMQPQueue</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="amqpqueue.get" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">AMQPQueue::get</h1>
  <p class="verinfo">(PECL amqp &gt;= Unknown)</p><p class="refpurpose"><span class="refname">AMQPQueue::get</span> &mdash; <span class="dc-title">Retrieve the next message from the queue.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-amqpqueue.get-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>AMQPQueue::get</strong></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = ini_get(&quot;amqp.auto_ack&quot;)</span></span>
     ] )</div>

     <p class="para rdfs-comment">
       Retrieve the next available message from the queue. If no messages are present in the queue, this function will return <strong><code>FALSE</code></strong> immediately. This is a non blocking alternative to the <span class="methodname"><a href="amqpqueue.consume.html" class="methodname">AMQPQueue::consume()</a></span> method.
     </p>
     <p class="para">
      Currently, the only supported flag for the <em><code class="parameter">flags</code></em> parameter is <strong><code>AMQP_AUTOACK</code></strong>. If this flag is passed in, then the message returned will automatically be marked as acknowledged by the broker as soon as the frames are sent to the client.
     </p>
    </div>


    <div class="refsect1 parameters" id="refsect1-amqpqueue.get-parameters">
     <h3 class="title">参数</h3>
     <p class="para">
      <dl>

      
       <dt>
<em><code class="parameter">flags</code></em></dt>

       <dd>

        <p class="para">
         A bitmask of supported flags for the method call. Currently, the only the supported flag is <strong><code>AMQP_AUTOACK</code></strong>. If this value is not provided, it will use the value of <em>amqp.auto_ack</em>.
        </p>
       </dd>

      
     </dl>

     </p>
    </div>


    <div class="refsect1 returnvalues" id="refsect1-amqpqueue.get-returnvalues">
     <h3 class="title">返回值</h3>
     <p class="para">
      An instance of <a href="class.amqpenvelope.html" class="classname">AMQPEnvelope</a> representing the message pulled from the queue, or <strong><code>FALSE</code></strong>.
     </p>
    </div>


    <div class="refsect1 examples" id="refsect1-amqpqueue.get-examples">
     <h3 class="title">范例</h3>
     <p class="para">
      <div class="example" id="example-4112">
       <p><strong>Example #1 <span class="methodname"><strong>AMQPQueue::get()</strong></span> example</strong></p>
       <div class="example-contents">
   <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Create&nbsp;a&nbsp;connection&nbsp;using&nbsp;all&nbsp;default&nbsp;credentials:&nbsp;*/<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$connection&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AMQPConnection</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$connection</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">connect</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$channel&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AMQPChannel</span><span style="color: #007700">(</span><span style="color: #0000BB">$connection</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;create&nbsp;a&nbsp;queue&nbsp;object&nbsp;*/<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$queue&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AMQPQueue</span><span style="color: #007700">(</span><span style="color: #0000BB">$channel</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//declare&nbsp;the&nbsp;queue<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$queue</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">declare</span><span style="color: #007700">(</span><span style="color: #DD0000">'myqueue'</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//get&nbsp;the&nbsp;message<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$message&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$queue</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #0000BB">AMQP_AUTOACK</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$message</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getBody</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
       </div>

      </div>
     </p>
    </div>


   </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="amqpqueue.delete.html">AMQPQueue::delete</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="amqpqueue.getargument.html">AMQPQueue::getArgument</a></div>
 <div class="up"><a href="class.amqpqueue.html">AMQPQueue</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
